package org.itfarmer.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.itfarmer.dao.ComplaintDAO;
import org.itfarmer.dao.pojo.Complaint;

@SuppressWarnings("unchecked")
public class ComplaintDAOImpl extends BaseDAOImpl<Complaint, Integer> implements ComplaintDAO {

	/*
	 * (non-Javadoc)
	 * @see org.itfarmer.dao.ComplaintDAO#readByWorkid(java.lang.Integer)
	 */
	public List<Complaint> readByWorkid(Integer workid, Integer firstRow, Integer maxRow) {
		if (workid == null) {
			return null;
		}
		this.init();
		String queryString = "from Complaint where workid=?";
		Query query = session.createQuery(queryString);
		List list = query.setInteger(0, workid).setFirstResult(firstRow).setMaxResults(maxRow).list();
		return list == null || list.size() == 0 ? null : list;
	}

	
}
 